<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core">
	<head><title>IGNORED</title></head>
    <body>
		<ui:composition template="../templates/layout.xhtml">
			<ui:define name="windowTitle">Daily Market | Administrator Console | Manage Categories</ui:define>
			<ui:define name="logoImage"><h:graphicImage library="images" name="logo_header.jpg" alt="logo" /></ui:define>
			<ui:define name="content">
				<div id="content" class="graphic_bg">
					<h:form>
						<div class="form-row header">Manage Categories
							<h:link outcome="new_category" styleClass="image-button no-height" style="float: right;">
								<h:graphicImage library="images/icons/16" name="add.png" styleClass="with-text" alt="a" title="Add New Category" />New Category
							</h:link>
						</div>
					</h:form>
					<h:messages styleClass="form-messages" fatalClass="form-messages error" errorClass="form-messages error" warnClass="form-messages warn" infoClass="form-messages good" />
					<h:form>
						<h:dataTable value="#{catListBean.allCategories}" var="category" style="margin-top: 5px; border: solid 4px #FFFFFF; border-collapse: collapse;" rowClasses="odd-row, even-row" headerClass="header-row" columnClasses="id-col,data-col,data-col,data-col,tools-col" >
							<h:column>
								<f:facet name="header">ID</f:facet>
								<h:outputText value="#{category.ID}" />
							</h:column>
							<h:column>
								<f:facet name="header">Name</f:facet>
								<h:inputText value="#{category.name}" rendered="#{category.editing}" />
								<h:outputText value="#{category.name}" rendered="#{not category.editing}" />
							</h:column>
							<h:column>
								<f:facet name="header">Description</f:facet>
								<h:inputTextarea value="#{category.desc}" rendered="#{category.editing}" cols="30" rows="5" />
								<h:outputText value="#{category.desc}" rendered="#{not category.editing}" />
							</h:column>
							<h:column>
								<f:facet name="header">Parent</f:facet>
								<h:outputText value="#{category.parentName}" style="font-style: italic;" />
							</h:column>
							<h:column>
								<h:commandLink action="#{catListBean.doCommitEditCategory(category)}" rendered="#{category.editing}">
									<h:graphicImage library="images/icons/32" name="accept.png" alt="a" title="Save" />
								</h:commandLink>
								<h:commandLink action="#{catListBean.doCancelEditCategory}" rendered="#{category.editing}">
									<h:graphicImage library="images/icons/32" name="cancel.png" alt="c" title="Cancel" />
								</h:commandLink>
								<h:commandLink action="#{catListBean.doEditCategory(category)}" rendered="#{not category.editing}" >
									<h:graphicImage library="images/icons/32" name="folder_edit.png" alt="e" title="Edit Category" />
								</h:commandLink>
								<a href="Javascript:;" onclick="do_confirm_delete_category('#{category.ID}', '#{category.name}')" >
									<h:graphicImage library="images/icons/32" name="folder_delete.png" alt="d" title="Delete Category" />
								</a>
								<h:commandLink action="#{catListBean.doDeleteCategory(category)}" styleClass="del-category-command" title="#{category.ID}" style="display: none; visibility: hidden;" />
							</h:column>
						</h:dataTable>
					</h:form>
				</div>
			</ui:define>
		</ui:composition>
	</body>
</html>